package com.jing21.learn.fs.controller;

import com.aliyuncs.sts.model.v20150401.AssumeRoleResponse;
import com.jing21.learn.fs.client.StsClient;
import com.jing21.learn.fs.service.FileSecurityService;
import com.jing21.learn.fs.util.PolicyUtilly;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.RestController;

/**
 * Create By zhengjing on 2017/11/16 10:01
 */
@RestController
public class StsController implements StsClient {

    @Autowired
    PolicyUtilly utilly;

    @Autowired
    FileSecurityService fileSecurityService;

    @Override
    @Cacheable
    public AssumeRoleResponse.Credentials getUserCredentials(String username) {

        return fileSecurityService.credentials(username);
    }
}
